package com.liupengyuan.system.user.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.liupengyuan.framework.dao.MybatisBaseGenericDAOImpl;
import com.liupengyuan.framework.util.GeneratorKey;
import com.liupengyuan.system.user.dao.UserDao;
import com.liupengyuan.system.user.model.User;
@Repository("userDao")
public class UserDaoImpl extends MybatisBaseGenericDAOImpl<User> implements UserDao {
	
	@Override
	public void generateId(User ob) {
		ob.setId(GeneratorKey.genaraId());
	}
	
	@Override
	public User login(User user){
		List<User> result = this.findListBy(user);
		if(result!=null && result.size()==1){
			return result.get(0);
		}else{
			throw new RuntimeException("记录数不等于1");
		}

	}
}
